Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flusing log uart during fault #6660

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ewoodev
Copy link
Contributor

@ewoodev ewoodev commented Feb 6, 2025

No description provided.

@ewoodev ewoodev changed the title Flusing log uart Flusing log uart during fault Feb 6, 2025
When system fault is occured, The system is in the irq locking state, The logs that have not
yet been output remain in the uart buffer and are not output.
So, For debugging, it is necessary to flush the log uart buffer before outputting the fault log.

For flushing transmit buffe, we need to know xmit buffer is empty or not.
Therefore, Add to so that uart_xmitchars function returns amount sent.
the return value is 0, xmit buffer is empty.

Signed-off-by: eunwoo.nam <[email protected]>
@ewoodev ewoodev force-pushed the WORK-250206_flush_log_uart branch 7 times, most recently from 4ed0553 to fef47cc Compare February 6, 2025 13:34

/* To avoid duplicated calling up_flush_console(). */
if (g_log_flush_running) {
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should have leave_critical_section here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, Updated!

…ault log.

since, The system fault is occured, uart log is stil in the uart buffer and not printed.
So, we can't see last log.

Therefore, Add flusing log uart buffer when fault is occured.

Signed-off-by: eunwoo.nam <[email protected]>
@ewoodev ewoodev force-pushed the WORK-250206_flush_log_uart branch from fef47cc to 9e0b6b9 Compare February 10, 2025 03:29
Comment on lines +1410 to +1413
do {
while (!LOGUART_Ready());
nbyte = uart_xmitchars(&CONSOLE_DEV);
} while (nbyte);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this work? Currently it looks like we still rely on uart interrupts to send data. But interrupts are disabled. Wont it be better to use lldbg path instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The IRQ is calling uart_xmitchars()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant uart_xmitchars path is through drivers (will call the drivers send function and it also has some signalling logic to wakeup other threads), but at this point, we are no longer using the driver's path to print logs. Instead we use lldbg, so I asked the above question, why not use up_putc instead of driver send.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants